package com.lone.demo.builderpattern;

import com.lone.demo.builderpattern.builders.CarBuilder;
import com.lone.demo.builderpattern.builders.CarManualBuilder;
import com.lone.demo.builderpattern.cars.Car;
import com.lone.demo.builderpattern.cars.Manual;
import com.lone.demo.builderpattern.director.Director;

/**
 * @author Lone
 * @date 2021/9/22 16:42 周三
 */
public class Demo {
    public static void main(String[] args) {
        Director director = new Director();

        CarBuilder carBuilder = new CarBuilder();
        director.constructSportCar(carBuilder);
        Car car = carBuilder.getResult();
        System.out.println("Car built:\n" + car.getCarType());
        System.out.println("Car built:\n" + car.getFuel());

        CarManualBuilder carManualBuilder = new CarManualBuilder();
        director.constructSportCar(carManualBuilder);
        Manual carManual = carManualBuilder.getResult();
        System.out.println("\nCar manual built:\n" + carManual.print());
    }
}
